package com.k.controller;

import org.springframework.security.access.annotation.Secured;
import org.springframework.security.access.prepost.PostAuthorize;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * @program: SpringSecote01
 * @ClassName UserController
 * @description:
 * @author: xiaoJie
 * @create: 2024-09-13 10:58
 * @Version 1.0
 */
@RestController
public class UserController {


    @Secured("ROLE_add")
    @RequestMapping("/user/Add")
    @ResponseBody
    public String save(){
        return "用户添加成功";
    }


    @PostAuthorize("hasAuthority('a:b:c')")
    @RequestMapping("/del")
    public String del(){
        System.out.println("删除");
        return "用户删除";
    }



    @PreAuthorize("hasAuthority('a:b:c')")
    @RequestMapping("/update")
    public String update(){
        System.out.println("修改");
        return "用户删除";
    }


}
